package controller.gui.mainmenu;

import java.awt.event.ActionEvent;

import javax.swing.JButton;

import controller.BackupMapUser;
import controller.Controller;
import controller.NullStaticObjectException;
import controller.PrimaryButtonController;
import controller.states.MapElementToAddStateUser;
import errors.DimensionNotAcceptableException;
import gui.secondary.BackgroundSecondaryMenu;

/**rappresenta il Controller che gestisce il pulsante che permette l'accesso al
 * wizard di gestione Background mappa
 * 
 * @author Koldar
 * @version 1.0
 */
public class BackgroundWizardController extends PrimaryButtonController implements BackupMapUser,MapElementToAddStateUser{
	
	private BackgroundSecondaryMenu secondarymenu;
	
	public BackgroundWizardController(JButton button,BackgroundSecondaryMenu menu){
		super(button);
		this.secondarymenu=menu;
	}
	
	@Override
	public void wizardInizializer(ActionEvent arg0)throws NullStaticObjectException, DimensionNotAcceptableException {
		try {
			this.backupmap.setValue(getCurrentmap().clone());
		} catch (CloneNotSupportedException error) {}
		this.mapElementToAddState.setValue(MapElementToAddStateUser.START);
		this.secondarymenu.setVisible(true);
	}

}
